package com.zkw.group.service;

import com.zkw.group.entity.Course;
import com.zkw.group.mapper.CourseMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CourseService {

    @Autowired
    private CourseMapper courseMapper;

    //分页获取课程列表
    public List<Course> getAllCourseList(String courseid,String username,int pageStart,int pageSize){
        return courseMapper.getAllCourseList(courseid,username,pageStart,pageSize);
    }

    //获取课程条目数
    public int getCourseCounts(String courseid,String username){
        return courseMapper.getCourseCounts(courseid,username);
    }

    //添加课程
    public int addCourse(Course course){
        return courseMapper.addCourse(course);
    }

    //获取要更新的课程信息以及更新课程
    public Course getUpdateCourse(String courseid){
        return courseMapper.getUpdateCourse(courseid);
    }

    public int updateCourse(Course course){
        return courseMapper.updateCourse(course);
    }

    //删除课程
    public int deleteCourse(String courseid){
        return courseMapper.deleteCourse(courseid);
    }

    //更新课程发布状态
    public int updateState(String state,String courseid){
        return courseMapper.updateState(state,courseid);
    }



    //获取课程详细信息
    public Course getCourseDetail(String courseid){
        return courseMapper.getCourseDetail(courseid);
    }

    //更新课程详细信息
    public int updateCourseDetail(Course course){
        return courseMapper.updateCourseDetail(course);
    }
}
